﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Data.SqlClient;

public partial class zhuce : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }

    protected sqlDataBase db = new sqlDataBase();
    /// <summary>
    /// 实现注册
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void Button1_Click1(object sender, EventArgs e)
    {
        string id = TextBoxName.Text.Trim();
        string usercode = TextBoxPassWord.Text.Trim();
        string username = TextBoxRealName.Text.Trim();
        string email = TextBoxEmail.Text.Trim();
        string tel = TextBoxPhone.Text.Trim();
        System.DateTime currentTime = new System.DateTime();
        currentTime = System.DateTime.Now;
        string datetime = currentTime.ToShortTimeString();
        string sqlstring = "insert into [b_user]values('" + id + "','" + username + "','" + usercode + "','"+datetime+"','" + email + "','" + tel + "')";
       
        try
        {
            db.runnosql(sqlstring);//执行SQL命令；
            Response.Write("<script>alert('恭喜你注册成功！')</script>");
            Response.Redirect("index.aspx");
        }
        catch (Exception ex)
        {
            Response.Write("<script>alert('"+ex.Message+"')</script>");
            return;
        }
    }
}
